import 'package:aio/aio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:app/generated/app_strings.dart';
import 'package:app/src/http/bean/http_data.dart';
import 'package:app/src/http/bean/wroks/address_bean.dart';
import 'package:app/src/http/bean/wroks/contract_bean.dart';
import 'package:app/src/ui/route/helper/route_helper.dart';
import 'package:app/src/ui/route/works/public/items/ui_base.dart';
import 'package:app/src/ui/route/works/public/items/ui_card.dart';

import '../../../../../http/bean/worksdo/material_requisition_bean.dart';
import '../../../../../http/bean/wroks/dispatchingaudit_bean.dart';
import '../../../../../http/model/config_model.dart';
import '../../../../dialog/dailog.dart';

///采购单信息
class UiMaterialAudit {
  ///data 信息
  ///oldData 历史信息
  static Widget build(BuildContext context, MaterialInfo? data,
      MaterialInfo? oldData, StateSetter setState,
      {String? title}) {
    List<Widget> children = [];
    if (StringUtils.isEmpty(title)) {
      title = AppStrings.of(context).PurchaseOrderInformation; //请购单信息
    }
    children.add(UiBase.title(context, title)); //标题
    var isGrey = false;
    children.add(UiBase.item(
        context,
        AppStrings.of(context).PurchaseOrderNumber,
        data?.PurCode,
        oldData?.PurCode,
        isAllowEmpty: true,
        defaultValue: AppStrings.of(context).Automaticgeneration,
        isGrey: isGrey)); //请购单号
    children.add(UiBase.item(context, AppStrings.of(context).ProjectName,
        data?.ProjectName, oldData?.ProjectName,
        isAllowEmpty: true, isBlue: false)); //项目名称
    children.add(UiBase.item(context, AppStrings.of(context).FactoryName3,
        data?.FactoryName, oldData?.FactoryName,
        isGrey: isGrey, isAllowEmpty: true)); //工厂
    if (StringUtils.isNotEmpty(data?.PurStartDate)) {
      children.add(UiBase.item(
        context,
        AppStrings.of(context).DateRequest,
        data?.getPurStartDate(),
        oldData?.getPurStartDate(),
        isAllowEmpty: true,
        isGrey: isGrey,
        isStart: true,
      )); //请购日期
    }
    children.add(UiBase.item(
      context,
      AppStrings.of(context).PurchaseDate3,
      data?.getPurEndDate(),
      oldData?.getPurEndDate(),
      isAllowEmpty: true,
      isGrey: isGrey,
      isStart: true,
    )); //要货日期
    children.add(UiBase.item(
      context,
      AppStrings.of(context).Bindornot,
      data?.getBind(context),
      oldData?.getBind(context),
      isAllowEmpty: true,
      isGrey: isGrey,
    )); //是否绑定

    children.add(UiBase.itemWithEdit(context, AppStrings.of(context).ItemIntro,
        data?.BeiZhu, oldData?.BeiZhu,
        isAllowEmpty: true, readOnly: true)); //备注
    var column = UiBase.column(context, children);
    var card = UiCard.build(context, column);
    return card;
  }
}
